var mongoose = require('mongoose');
mongoose.connect('mongodb://199.83.51.27/itravel', function (err) {
    if (err) {
        console.log('connect to db error: ' + err.message);
        process.exit(1);
    }
    console.log('数据库连接成功');
});

var models = ['user', 'media'];
models.forEach(function (item) {
    require('./' + item);
    exports[item] = mongoose.model(item);
});
module.exports = exports;